import {requestApi} from '@/utils/request'
import type { getCityListResponse, getCityListByTypeResponse, searchCityResponse } from '@/types/search'

// 城市选择界面，进入界面获取左边的国家城市分类
export const getCityListAPI = () => {
    return requestApi<getCityListResponse>({
        url: '/country-class',
        method: 'GET'
    })
}

// 用户根据分类选择地址
export const getCityListByTypeAPI = (type: string) => {
    return requestApi<getCityListByTypeResponse>({
        url: '/choose-address',
        method: 'GET',
        data: {
            type
        }
    })
}

// 搜索省市数据
export const searchCityAPI = (keywords: string) => {
    return requestApi<searchCityResponse>({
        url: '/china-data',
        method: 'GET',
        data: {
            keywords
        }
    })
}